![]() |
PATH![]() |
![]() ![]() |
The following Dialog Manager functions for manipulating items in dialog boxes and alert boxes are new, changed, or not recommended with Appearance Manager 1.0:
Obtains the control handle for a dialog item in an embedding hierarchy.
pascal OSErr GetDialogItemAsControl (
DialogPtr inDialog,
SInt16 inItemNo,
ControlHandle *outControl);
When an embedding hierarchy is established, GetDialogItemAsControl produces a handle to the embedded controls (except Help items). It should be used instead of GetDialogItem when an embedding hierarchy is established.
Obtains a handle to a dialog item.
pascal void GetDialogItem (
DialogPtr theDialog,
short itemNo,
short *itemType,
Handle *item,
Rect *box);
The GetDialogItem function produces the item type, a handle to the item (or, for application-defined draw functions, the function pointer), and the display rectangle for a specified item in an item list resource. When a control hierarchy is present in the dialog box, GetDialogItem gets the appropriate information (for example, a text handle) from the controls. If you wish to get a control handle for a dialog item in an embedding hierarchy, see GetDialogItemAsControl .
You should call GetDialogItem before calling functions such as SetDialogItemText that need a handle to a dialog item.
Sets or changes information for a dialog item.
pascal void SetDialogItem (
DialogPtr theDialog,
short itemNo,
short itemType,
Handle item,
const Rect *box);
When the Appearance Manager is available and an embedding hierarchy is established, you should call the Control Manager function GetKeyboardFocus instead of GetDialogKeyboardFocusItem to return the item number of the item in a dialog box that has keyboard focus.
Determines the item number of an item at a particular location in a dialog box.
pascal short FindDialogItem (
DialogPtr theDialog,
Point thePt);
The function FindDialogItem is useful for changing the cursor when the user moves the cursor over a particular item.
To get the proper item number before calling the GetDialogItem GetDialogItem function or the SetDialogItem function, add 1 to the result of FindDialogItem , as shown here:
theItem = FindDialogItem(theDialog, thePoint) + 1;
Note that FindDialogItem returns the item number of disabled items as well as enabled items.
Moves a dialog item to a specified location in a window.
pascal OSErr MoveDialogItem (
DialogPtr inDialog,
SInt16 inItemNo,
SInt16 inHoriz,
SInt16 inVert);
pascal OSErr SizeDialogItem (
DialogPtr inDialog,
SInt16 inItemNo,
SInt16 inWidth,
SInt16 inHeight);
Automatically resizes static text fields and their dialog boxes to accommodate changed static text.
pascal OSErr AutoSizeDialog (DialogPtr inDialog);
The AutoSizeDialog function is useful in situations such as localization, where the size of a static text field (and the dialog box that contains it) may need to be altered to accommodate a change in the size of the static text.
For each static text item AutoSizeDialog finds in the item list resource, it adjusts the static text field and the bottom of the dialog box window to accommodate the text. Any items below a static text field are moved down. If the dialog box is visible when this function is called, it is hidden, resized, and then shown. If the dialog box has enough room to show the text as is, no resizing is done.
Note that the AutoSizeDialog function does not process update events for your dialog box, so your program must call the DrawDialog function or the DialogSelect function to process the update event generated from showing the window.
Adds items to an existing dialog box while your program is running.
pascal OSErr AppendDialogItemList (
DialogPtr dialog,
SInt16 ditlID,
DITLMethod method);
To be Appearance-compliant, your program should use the AppendDialogItemList function rather than the AppendDITL function. Unlike AppendDITL , the AppendDialogItemList function takes a 'DITL' resource ID instead of a handle as the parameter describing the dialog item list to be appended, and it properly appends entries from a dialog font table ('dftb') resource, if there is a 'dftb' resource with the same resource ID as the 'DITL' resource.
The AppendDialogItemList function adds the items in the item list resource specified in the parameter ditlID to the items of a dialog box. This is especially useful if several dialog boxes share a single item list resource, because you can use AppendDialogItemList to add items that are appropriate for individual dialog boxes. Your application can use the Resource Manager function GetResource to get a handle to the item list resource whose items you wish to add.
You typically create an invisible dialog box, call the AppendDialogItemList function, then make the dialog box visible by using the Window Manager function ShowWindow .